<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Task,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
if(!globa.userSession.hasRight("10010"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<% 
    //初始化
    Task  task0=null;
    Task obj=new Task(globa);
    //查询条件
    String  strName=ParamUtil.getString(request,"strName","").trim();
	String tWhere="";
	if (!strName.equals("")) {
		tWhere += " and strName LIKE '%" + strName + "%'";
	}
	tWhere += " ORDER BY strName";
	
	//记录总数
	int intAllCount=obj.getCountLast(tWhere);
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
    int intPageSize;
    if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<Task> vctObj=obj.listLast(tWhere,intStartNum,intPageSize);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script language="javascript">
//增加信息
function add() {
   frm.action="task_add.jsp";
   frm.submit();
}

 function showAc(){
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
</script>
<style>
A {text-decoration: NONE} 
</style>
</head>


<body>
<form name=frm method=post action="task_list.jsp"> 
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">资源配置</font> &gt; 任务列表</td>
  </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="89%">AP名称：
          <input type="text" name="strName" value="<%=strName %>"/>
          <img src="../images/search.jpg" width="58" height="28" align="absmiddle" onclick="showAc()" style="cursor:hand"/></td>
          <td width="11%" align="right"><img src="../images/add.jpg" width="64" height="27" onClick="add()" style="cursor:hand"/></td>
        </tr>
      </table></td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>
    
    <td class="listtit">AP名称</td>
    <td class="listtit">AP的MAC地址</td>
    <td class="listtit">任务测试内容</td>
    <td class="listtit">任务测试状态</td>
    <td class="listtit" width="15%">任务描述</td>
    <td class="listtit">创建人</td>
    <td class="listtit">创建时间</td>
    <td class="listtit" width="20%">基本操作</td>
  </tr>
    <%
            
              for (int i = 0;i < vctObj.size(); i++) {
              String id = "";
              String name = "";
              String mac="";
              String testcontent="";
              String desc="";
              String creator="";
              String dtcreattime="";
              Task obj1 = vctObj.get(i);
              int intState = obj1.getIntState();
              String intStateString = intState == 0?"未测试":"已测试";
              id= Format.forbidNull(obj1.getStrId());
              name= Format.forbidNull(obj1.getStrName());
              mac= Format.forbidNull(obj1.getStrMac());
              testcontent= Format.forbidNull(obj1.getStrTestContent());
              desc= Format.forbidNull(obj1.getStrDesc());
              creator= Format.forbidNull(obj1.getStrCreator());
              System.out.println("====创建人"+creator);
              dtcreattime = Format.forbidNull(obj1.getDtCreatTime());
                 
                 
            	//if(obj1.getStrId()!=null)id=obj1.getStrId();
            	//if(obj1.getStrName()!=null)name=obj1.getStrName();
            	//if(obj1.getStrMac()!=null)mac = obj1.getStrMac();
            	//f(obj1.getStrTestContent()!=null)testcontent = obj1.getStrTestContent();
            	//if(obj1.getStrDesc()!=null)desc = obj1.getStrDesc();
            	//if(obj1.getStrCreator()!=null)creator = obj1.getStrCreator();
            	//if(obj1.getDtCreatTime()!=null)dtcreattime = obj1.getDtCreatTime();
            %>

  <tr>
    <td class="listd1" style="border-left:1px solid #dddddd;"> <%=name %></a>&nbsp;</td>
    <td class="listd1"><%=mac %>&nbsp;</td>
    <td class="listd1"><%=testcontent%>&nbsp;</td>
    <td class="listd1"><%=intStateString%>&nbsp;</td>
    <td class="listd1"><%=desc%>&nbsp;</td>
    <td class="listd1"><%=creator%>&nbsp;</td>
    <td class="listd1"><%=dtcreattime%>&nbsp;</td>
    <td class="listdrd" style="border-right:1px solid #dddddd;"> <img src="../images/mid.jpg" width="12" height="12" align="absmiddle" /> <a href="task_look.jsp?strId=<%=obj1.getStrId()%>" >查看</a> <img src="../images/del.jpg" width="11" height="11" align="absmiddle" /> <a href="#" onclick="if(confirm('确认删除该记录？')){location.href='task_act.jsp?<%=Constants.ACTION_TYPE%>=<%=Constants.DELETE_STR%>&strId=<%=obj1.getStrId()%>';}" >删除</a></td>  
  </tr>
             <%
            }
            %>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images1/pldel.jpg" width="83" height="27" align="absmiddle" style="cursor:hand"/>--> &nbsp;&nbsp;页面记录数

        <select name="strPageSize" id="strPageSize"  onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		%>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>  
   		 
      </select>  
    
    </td>
    <td></td>		
    <td width="39%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
      </tr>
    </table>--><!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
 
</table>



 </form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>

